<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport('joomla.application.component.model');
jimport( 'joomla.user.user' );
$parampath = JPATH_ADMINISTRATOR.DS.'components'.DS.'com_content'.DS.'models';
require_once($parampath.DS."articles.php");
class DebateModelApprove extends JModel
{
	
	function getDebates()
    {
		$users = new ContentModelArticles();
        return $users->getItems();
    }
	function getApprove(){
		$userid = JRequest::getVar( 'user_id' );
		$db =& JFactory::getDBO();
		$query = "SELECT approve_debate FROM #__debate WHERE user_id = ".$userid.";";
		$db->setQuery($query);
		$result = $db->loadObjectList();
		
		if($result )
		$result = unserialize($result[0]->approve_debate);
		return $result;
	}
	function getRejected(){
		$userid = JRequest::getVar( 'user_id' );
		$db =& JFactory::getDBO();
		$query = "SELECT rejected_debate FROM #__debate WHERE user_id = ".$userid.";";
		$db->setQuery($query);
		$result = $db->loadObjectList();
		if($result )
		$result = unserialize($result[0]->rejected_debate);
		return $result;
	}
}
